{% extends '@SyliusAdmin/shared/form_theme.html.twig' %}

{%- block live_collection_widget -%}
    {{ block('form_widget') }}
{%- endblock live_collection_widget -%}

{%- block live_collection_entry_row -%}
    <div id="{{ id }}" {{ block('attributes') }} {{ sylius_test_html_attribute('entry-row') }}>
        {{- form_errors(form) -}}
        {{- form_row(form.type) -}}

        <div class="alert text-body flex-column gap-0">
            <div class="d-flex align-items-center">
                <div class="me-auto mb-3"><strong>{{ (form.vars.types[form.type.vars.data])|trans }}</strong></div>
                {{- form_row(button_delete, sylius_test_form_attribute('delete-action')|sylius_merge_recursive({'attr': {'class': 'btn-close'}})) -}}
            </div>
            <div class="flex-grow-1">
                {{- form_row(form.configuration, {'label': false}) -}}
            </div>
        </div>
    </div>
{%- endblock live_collection_entry_row -%}

{% block add_button_row %}
    {% if types is not empty %}
        <div class="dropdown">
            <button class="btn dropdown-toggle" type="button" data-bs-toggle="dropdown">{{ label|trans }}</button>
            <ul class="dropdown-menu">
                {% for type, label in types %}
                    <li>
                        <button class="dropdown-item" type="button" {{ block('button_attributes') }} data-live-type-param="{{ type }}" {{ sylius_test_html_attribute('add-' ~ type) }}>
                            {{ (label)|trans }}
                        </button>
                    </li>
                {% endfor %}
            </ul>
        </div>
    {% endif %}
{% endblock %}
